<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('商家列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								商家名称：<input type="text" name="businessName"/>
							</li>
							<li>
								联系方式：
				                <select id="contactType" name="contactType" th:with="type=${@dict.getType('sys_contact_type')}">
									        <option value="">所有</option>
						                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						       </select>
							</li>

							<li>
								联系号码：<input type="text" name="contactNo"/>
							</li>

							<li>
								通道类型：
								<select id="channelType" name="channelType" th:with="type=${@dict.getType('sys_channel_type')}">
									        <option value="">所有</option>
						                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						       </select>
							</li>

							

							<li>
								收款方式：
								<select id="paymentMethod" name="paymentMethod" th:with="type=${@dict.getType('sys_payment_method')}">
									        <option value="">所有</option>
						                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
						       </select>
							</li>

							<li>
								收款账号：<input type="text" name="account"/>
							</li>

							<li>
								状态：<select name="status">
							            <option value="">所有</option>
								        <option value = "0">正常</option>
								        <option value = "1">停用</option>
							   </select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="channel:businessInfo:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="channel:businessInfo:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="channel:businessInfo:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="channel:businessInfo:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('channel:businessInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('channel:businessInfo:remove')}]];
        var datastatus = [[${@dict.getType('sys_normal_disable')}]];
        var dataCT = [[${@dict.getType('sys_contact_type')}]];
        var dataC = [[${@dict.getType('sys_channel_type')}]];
        var dataPM = [[${@dict.getType('sys_payment_method')}]];
        var prefix = ctx + "channel/businessInfo";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "商家",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'businessId', 
					title : '主键',
					visible: false
				},
				{
					field : 'businessName', 
					title : '商家名称',
					sortable: true
				},
				{
					field : 'contactType', 
					title : '联系方式',
					formatter: function(value, row, index) {
				           return $.table.selectDictLabel(dataCT, value);
				    },
					sortable: true
				},
				{
					field : 'contactNo', 
					title : '联系号码',
					sortable: true
				},
				{
					field : 'channelType', 
					title : '通道类型',
					formatter: function(value, row, index) {
				           return $.table.selectDictLabel(dataC, value);
				    },
					sortable: true
				},
				{
					field : 'channelRate', 
					title : '费率',
					sortable: true
				},
				{
					field : 'paymentMethod', 
					title : '收款方式',
					formatter: function(value, row, index) {
				           return $.table.selectDictLabel(dataPM, value);
				    },
					sortable: true
				},
				{
					field : 'account',
					title : '收款账号',
					sortable: true
				},
				{
					field : 'status', 
					title : '状态',
					formatter: function(value, row, index) {
				           return $.table.selectDictLabel(datastatus, value);
				    },
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.businessId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.businessId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>